package com.zhouyx.eurekafeignconsumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zhouyx.eurekafeignapi.service.HelloService;

@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class EurekaFeignConsumerApplication {

	@FeignClient("eureka-feign-client")
	interface  HelloServiceClient extends HelloService{

	}


	@RestController
	class  TestController{
		@Autowired
		private  HelloServiceClient helloServiceClient;

		@GetMapping("/test")
		public  String test(String name){
			return  helloServiceClient.hello(name);
		}
	}

	public static void main(String[] args) {
		SpringApplication.run(EurekaFeignConsumerApplication.class, args);
	}
}
